﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace StockAna
{
    public partial class ListForm : Form
    {
        public ListForm()
        {
            InitializeComponent();
        }

        public void Setup(StockSafe[] list)
        {
            foreach (StockSafe item in list)
            {
                dataGridView1.Rows.Add(item.code, item.name, item.safe_rate, 100*(item.running2+item.refix)/item.discount, 
                    item.discount, item.profit1 + item.profit2, item.running2, item.running1_inc + item.running2_inc, item.pay1 + item.pay2, item.bonus2, item.refix);
            }
        }

        private void dataGridView1_RowHeaderMouseDoubleClick(object sender, DataGridViewCellMouseEventArgs e)
        {
            string code = dataGridView1.Rows[e.RowIndex].Cells[0].Value as string;
            StockSafe ss = StockSafe.Find(code);
            SafeEditForm edit = new SafeEditForm(ss);
            edit.Show();
        }
    }
}
